package com.dinner.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dinner.entity.DiUser;
import com.dinner.entity.OrderMenu;
import com.dinner.mapper.DiMenuMapper;
import com.dinner.mapper.DiUserMapper;
import com.dinner.mapper.OrderMenuMapper;
import com.dinner.service.OrderMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dinner
 * @since 2022-02-13
 */
@Service
public class OrderMenuServiceImpl extends ServiceImpl<OrderMenuMapper, OrderMenu> implements OrderMenuService {
     @Autowired
    OrderMenuMapper orderMenuMapper;
    @Autowired
    DiMenuMapper diMenuMapper;
    @Override
    public List<OrderMenu> findAll(int orderId) {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("order_id",orderId);
        List<OrderMenu> list=orderMenuMapper.selectList(wrapper);
        for(OrderMenu a:list){
            a.setDiMenu(diMenuMapper.selectById(a.getMenuId()));

        }
        return list;
    }
}
